package com.blue.rpc.server;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.blue.core.dict.State;
import com.blue.core.util.JsonUtil;
import com.blue.rpc.server.facade.UserInfoFacade;
import com.blue.rpc.server.model.UserInfo;

public class RpcClientMain
{
	private static String[] springs = {"spring/rpc-client.xml"};
	
	public RpcClientMain()
	{
	}
	
	public static void main(String[] args) throws Exception
	{
		ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(springs);
		
		Thread.sleep(1000);
		UserInfoFacade userInfoFacade = ctx.getBean(UserInfoFacade.class);
		
		UserInfo userInfo = new UserInfo();
		userInfo.setId(1);
		userInfo.setName("blue");
		userInfo.setRegTime(new Date());
		userInfo.setLoginTime(LocalDateTime.now());
		userInfo.setBirthday(LocalDate.now());
		userInfo.setState(State.NORMAL);
		
		userInfo = userInfoFacade.hello(userInfo);
		System.out.println(JsonUtil.output(userInfo));
		
		ctx.close();
	}
	
}
